package com.silence.Interface_test;

import java.util.ArrayList;

public class ClassManager {
    private ArrayList<Student> students =  new ArrayList<>();
    //面向接口编程，只需要修改后面StudentOperatorImpl是1还是2，就能修改输出统计的内容
    private StudentOperator studentOperator = new StudentOperatorImpl1();

    public ClassManager(){
        //添加学生
        //无参，创建对象的时候自动调用
        students.add(new Student("卡特琳娜",'女',99));
        students.add(new Student("卡莎",'女',88));
        students.add(new Student("卡兹克",'男',77));
        students.add(new Student("玛卡巴卡",'男',66));
        students.add(new Student("唔西迪西",'女',55));
    }

    //打印全部信息
    public void printInfo(){
        studentOperator.printAllInfo(students);
    }
    //打印全部学生平均分
    public void printScore(){
        studentOperator.printAverageScore(students);
    }
}
